for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
const { join } = require('path')
const { getAllRuleName, load } = require('./helper/rules')
module.exports = options => {
// Get all rule name
const ruleFunc = []
const ruleDir = join(__dirname, options.path || '')
const allRules = getAllRuleName(ruleDir)
// Load rule in order
const config = options.order || []
allRules.sort((a, b) => config.indexOf(a) > config.indexOf(b))
allRules.map(name => {
if (config && config.indexOf(name) === -1) {
return
}
const ruleLocation = join(ruleDir, name)
// import the rule
ruleFunc.push(load(ruleLocation))
})
return ruleFunc